﻿using System.Collections;
using System.Collections.Generic;
using UI;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class LodinPanel : BasePanel {

    private CanvasGroup canvasGroup;//获取CanvasGroup组件，用于控制该面板的交互功能
    public InputField attaci;
    public InputField password;
    private const string _attaci="admin";
    private const string _password="root";
    // Use this for initialization
    void Awake () {
        canvasGroup = GetComponent<CanvasGroup>();

    }
	
	// Update is called once per frame
	void Update () {
		
	}
    public override void OnEnter()
    {
        canvasGroup.blocksRaycasts = true;
        gameObject.SetActive(true);
    }
    public override void OnExit()
    {
        canvasGroup.blocksRaycasts = false;
        gameObject.SetActive(false);
        //DestroyImmediate(gameObject);
    }
    /// <summary>
    /// 登陆验证
    /// </summary>
    /// <returns></returns>
    private bool Verification()
    {
        return true;
    }

    public void LodinOnClick(string panelTypeString)
    {
        if (attaci.text == _attaci && password.text == _password)
        {
            UIPanelType panelType = (UIPanelType)System.Enum.Parse(typeof(UIPanelType), panelTypeString);
            UIManager.Instance.PopPanel();
            UIManager.Instance.PushPanel(panelType);
        }
    }
    public void QuaitApp()
    {
        Application.Quit();
    }
}

